package com.taotao.rest.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.bean.TaotaoResult;
import com.taotao.rest.service.ItemService;
/**
 * 商品信息controller
 * @author zqx the monster
 *
 */
@Controller
@ResponseBody
@RequestMapping("/item")
public class ItemController {
	
	@Autowired
	private ItemService itemService;
	
	/**
	 * 获取商品基本信息
	 * @param itemId
	 * @return
	 */
	@RequestMapping("/info/{itemId}")
	public TaotaoResult getItemBaseInfo(@PathVariable long itemId) {
		TaotaoResult info = itemService.getItemBaseInfo(itemId);
		return info;
	}
	
	/**
	 * 获取商品详情
	 * @param itemId
	 * @return
	 */
	@RequestMapping("/desc/{itemId}")
	public TaotaoResult getItemDesc(@PathVariable long itemId) {
		TaotaoResult itemDesc = itemService.getItemDesc(itemId);
		return itemDesc;
	}
	/**
	 * 获取商品规格参数
	 * @param itemId
	 * @return
	 */
	@RequestMapping("/param/{itemId}")
	public TaotaoResult getItemParamItem(@PathVariable long itemId) {
		TaotaoResult itemParam = itemService.getItemParam(itemId);
		return itemParam;
	}
}
